Skip to content

refactor: DRY test files with helper functions#14

Merged
ammario merged 1 commit into
mainfrom
tmp
Oct 4, 2025
Merged

refactor: DRY test files with helper functions#14
ammario merged 1 commit into
mainfrom
tmp

Conversation

@ammario

@ammario ammario commented Oct 4, 2025

Copy link
Copy Markdown
Member

Refactors test files to reduce duplication by extracting helper functions.

Changes

  • parser.test.ts: 213 → 196 lines (-8%)

    • Added expectParse(), expectProvidersSet(), expectModelSet() helpers
    • Table-driven test for missing args cases
  • file_edit_replace.test.ts: 563 → 551 lines (partial)

    • Added setupFile(), readFile(), executeReplace() helpers
    • Eliminated repetitive setup boilerplate

All tests pass ✅

- Add helper functions to parser.test.ts (expectParse, expectProvidersSet, expectModelSet)
- Add helper functions to file_edit_replace.test.ts (setupFile, readFile, executeReplace)
- Consolidate repetitive parse-and-assert patterns
- Use table-driven test for missing args cases
- Reduce parser.test.ts from 213 to 196 lines (8% reduction)
- Reduce file_edit_replace.test.ts from 563 to 551 lines (partial refactoring)
- All tests pass, no behavior changes
@ammario ammario merged commit 6927c9c into main Oct 4, 2025
6 of 8 checks passed
@ammario ammario deleted the tmp branch October 4, 2025 20:28
duynguyen020304 pushed a commit to duynguyen020304/mux that referenced this pull request May 10, 2026
…RY, tests

Batch 1 — Compile Errors & Correctness:
- Add TOGGLE_KANBAN to KEYBIND_LABELS and KEYBIND_GROUPS (coder#1)
- Fix Ctrl+K conflict → Ctrl+Shift+K to avoid PREV_WORKSPACE collision (coder#2)
- Add TOGGLE_KANBAN dispatch handler in App.tsx (coder#3)
- Fix dirty-cache in promoteQueuedTask: move flag clearing after moveTask (coder#5)
- Wrap 4 IPC helpers in KanbanBoard with try/catch (coder#4)

Batch 2 — Consistency & DRY:
- Deduplicate KanbanColumnSchema: import from canonical orpc/schemas (coder#6)
- Remove unused KanbanBoardData import from kanbanStorage.test (coder#7)
- Remove dead KANBAN_STORAGE_KEYS constant (coder#8)
- Replace console.warn with log helper in kanbanStorage (coder#9)
- Replace useEffect form reset with key prop in TaskDetailModal (coder#10)
- Remove unsafe {} as KanbanTask cast, use EMPTY_FORM pattern (coder#11)
- Add loading state + error logging to KanbanView (coder#12, coder#13)
- Add KANBAN_STATUS_LABELS helper, use in TaskDetailModal (coder#14)
- Validate column membership in reorderTasks (coder#15)
- Use KanbanTaskPriority type import in TaskCreateModal (coder#16)

Batch 3 — Tests:
- Add 4 tests for updateColumn (coder#17)
- Add 3 tests for promoteQueuedTask (coder#18)
- Rename misleading test 'rejects empty title' → 'accepts empty title' (coder#19)

43 tests pass (was 36). No typecheck or lint regressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant